package com.deyuanyun.pic.pbf.service.impl;

import com.deyuanyun.pic.common.util.ObjectUtil;
import com.deyuanyun.pic.pbf.domain.RepairPipeWeldExample;
import com.deyuanyun.pic.pbf.domain.RepairPipeWelding;
import com.deyuanyun.pic.pbf.domain.RepairPipeWeldingExample;
import com.deyuanyun.pic.pbf.mapper.RepairPipeWeldMapper;
import com.deyuanyun.pic.pbf.mapper.RepairPipeWeldingMapper;
import com.deyuanyun.pic.pbf.service.RepairPipeWeldingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 换管焊接信息服务实现类
 *
 * @author huanglw
 * @date 2016-6-5
 *
 * History: [修改人][时间][修改描述]
 */
@Service
public class RepairPipeWeldingServiceImpl implements RepairPipeWeldingService {
    @Autowired
    private RepairPipeWeldingMapper repairPipeWeldingMapper;

    @Override
    public RepairPipeWelding findRepairPipeWelding(String replacePipeId) {
        RepairPipeWeldingExample repairPipeWeldingExample = new RepairPipeWeldingExample();
        repairPipeWeldingExample.createCriteria().andReplacePipeIdEqualTo(replacePipeId).andDeletedEqualTo((short)0);
        List<RepairPipeWelding> repairPipeWeldingList = this.repairPipeWeldingMapper.selectByExample(repairPipeWeldingExample);
        return ObjectUtil.isEmptyAll(repairPipeWeldingList) ? null : repairPipeWeldingList.get(0);
    }
}
